{% extends 'AdminPanelDashboardBundle::layout.html.twig' %}


{% block stylesheets %}
  {{ parent() }}
{% endblock %}

{% block javascripts %}
{{ parent() }}
<!-- jQuery Validate -->
<script src="/adminTemplate/theme/scripts/jquery-validation/dist/jquery.validate.min.js" type="text/javascript"></script>
<script src="/adminTemplate/theme/scripts/form_validator.js" type="text/javascript"></script>
<script src="/ckeditor/ckeditor.js"></script>
<script>
function changeTitle(defaultObject){
  
  var tmpTitle = $(defaultObject).val();
  $("#slug").val('content/'+tmpTitle);
  
}
</script>

{% endblock %}

{% block content %}

<div id="content">
  <ul class="breadcrumb">
    <li><a href="index.php" class="glyphicons home"><i></i> AdminPlus</a></li>
    <li class="divider"></li>
    <li>Forms</li>
    <li class="divider"></li>
    <li>Form Validator</li>
  </ul>
  <div class="separator"></div>

  <h3 class="glyphicons show_thumbnails_with_lines"><i></i> Контент засварлах</h3>
  <div class="separator"></div>
  
  <form class="form-horizontal" style="margin-bottom: 0;" id="contentEditForm" action="{{ path('content_update', { 'id': entity.id }) }}" method="post" {{ form_enctype(edit_form) }} autocomplete="off">

    <div class="well" style="padding-bottom: 20px; margin: 0;">
      <h4>{{entity.contentTitle}}</h4>
      <hr class="separator" />
      <div class="row-fluid">
        <div class="span6" style="width: 90%">          
          <div class="control-group">                
              {{ form_label(edit_form.content_title, label|default(null), { 'label_attr': { 'class': 'control-label' } }) }}
              <div class="controls">{{ form_widget(edit_form.content_title, { 'id':'content_title', 'attr': {'class': 'span12', 'onChange':'changeTitle(this)'} }) }}</div>
          </div>
           
          <div class="control-group">  
            <div class="widget-body" style="padding: 10px 0 0;">              
              {{ form_label(edit_form.content_body, label|default(null), { 'label_attr': { 'class': 'control-label' } }) }}
                <div class="controls">{{ form_widget(edit_form.content_body, { 'id' : 'editor1', 'attr': {'class': 'ckeditor span12', 'rows' : '5'} }) }}</div>              
            </div>
          </div>

          <div class="control-group">                
              {{ form_label(edit_form.category, label|default(null), { 'label_attr': { 'class': 'control-label' } }) }}
              <div class="controls">{{ form_widget(edit_form.category, {'id' : 'contentCategory', 'attr': {'class': 'span12'} }) }}</div>
          </div>

          <div class="control-group">                
             {{ form_label(edit_form.menu, label|default(null), { 'label_attr': { 'class': 'control-label' } }) }}
              <div class="controls">{{ form_widget(edit_form.menu, { 'attr': {'class': 'span12'} }) }}</div>
          </div>

          <div class="control-group">                
            {{ form_label(edit_form.slug, label|default(null), { 'label_attr': { 'class': 'control-label' } }) }}
              <div class="controls">{{ form_widget(edit_form.slug, {'id' : 'slug', 'attr': {'class': 'span12', 'readonly':'readonly'} }) }}</div>
          </div>
            
          <div class="control-group">                
              {{ form_label(edit_form.img_thumb, label|default(null), { 'label_attr': { 'class': 'control-label' } }) }}
              <div class="controls">{{ form_widget(edit_form.img_thumb, { 'attr': {'class': 'span12'} }) }}</div>
          </div>

          <div class="control-group">                
            {{ form_label(edit_form.img_large, label|default(null), { 'label_attr': { 'class': 'control-label' } }) }}
              <div class="controls">{{ form_widget(edit_form.img_large, { 'attr': {'class': 'span12'} }) }}</div>
          </div>
            
          <div class="control-group">                
              {{ form_label(edit_form.is_special, label|default(null), { 'label_attr': { 'class': 'control-label' } }) }}
              <div class="controls">{{ form_widget(edit_form.is_special, { 'attr': {'class': 'span12'} }) }}</div>
          </div>

          <div class="control-group">                
              {{ form_label(edit_form.is_active, label|default(null), { 'label_attr': { 'class': 'control-label' } }) }}
              <div class="controls">{{ form_widget(edit_form.is_active, { 'attr': {'class': 'span12'} }) }}</div>
          </div>
        </div>
      </div>
      
      <hr class="separator" />
      
      <div class="form-actions">
        <button type="submit" class="btn btn-icon btn-primary glyphicons circle_ok"><i></i>Хадгалах</button>
        <a href="{{ path('content') }}"><button type="button" class="btn btn-icon btn-default glyphicons circle_remove"><i></i>Буцах</button></a>
      </div>
    </div>
    {{ form_widget(edit_form._token) }}
  </form>
  
  <form action="{{ path('content_delete', { 'id': entity.id }) }}" method="post">
          {{ form_widget(delete_form) }}
          <button type="submit" class="btn btn-danger btn-icon" style="margin-left: 40px;">Delete</button>
  </form>
  <!-- End Content -->
</div>

{% endblock %}


